using System;
using SmartMathLibrary;

namespace SmartMathLibrary.QuadPack
{
    /// <summary>
    /// DQAWS - Approximation to integral with algebraic and/or logarithmic singularities.
    /// </summary>
    [Serializable]
    public static class DqawsClass
    {
        /// <summary>
        /// Approximation to integral with algebraic and/or logarithmic singularities.
        /// </summary>
        /// <param name="f">Double precision function to be integrated.</param>
        /// <param name="a">Lower limit of integration.</param>
        /// <param name="b">Upper limit of integration.</param>
        /// <param name="alfa">The parameter in the weight function.</param>
        /// <param name="beta">The parameter in the weight function.</param>
        /// <param name="wgtfunc">Indicates which weight function is to be used: = 1:    (x-a)^alfa * (b-x)^beta; = 2:    (x-a)^alfa * (b-x)^beta * log(x-a); = 3:    (x-a)^alfa * (b-x)^beta * log(b-x); = 4:    (x-a)^alfa * (b-x)^beta * log(x-a) * log(b-x).</param>
        /// <param name="epsabs">The absolute accuracy requested.</param>
        /// <param name="epsrel">The relative accuracy requested.</param>
        /// <param name="abserr">The estimate of the modulus of the absolute error.</param>
        /// <param name="neval">The needed function evalations.</param>
        /// <param name="ier">The requested errorcode.</param>
        /// <returns>The approximation to the specified integral.</returns>
        public static double Dqaws(HardRealFunction f, double a, double b, double alfa, double beta, int wgtfunc,
                                   double epsabs, double epsrel, ref double abserr, ref int neval, ref int ier)
        {
            double result;

            result = DqawseClass.Dqawse(f, a, b, alfa, beta, wgtfunc, epsabs, epsrel, ref abserr, ref neval, ref ier);
            return result;
        }
    }
}